package com.monlyu.action;

import com.monlyu.bean.Page;
import com.monlyu.util.ActionUtil;
import com.monlyu.util.NumberUtil;

/*******************************************************************************
 * 
 * <b>功能描述☞</b>任何需要分页的Action 均继承该页面<br>
 * 
 * <b>开发公司☞</b>重庆唯尼科技有限公司<br>
 * <b>版权☞</b>本文件归重庆唯尼科技有限公司所有<br>
 * <b>项目名☞</b>monlyu<br>
 * <b>文件路径☞</b>com.monlyu.bean.Page.java<br>
 * <b>开发日期☞</b>2010-1-12 <br>
 * 
 * @author monlyu
 * @since JDK 5
 * @version 1.0.5
 * 
 ******************************************************************************/
public class PageAction extends BaseAction {
	private int size = ActionUtil.PAGE_SIZE;
	private String key;
	private boolean asc;
	private String store;
	private int current;

	public int getCurrent() {
		return current;
	}

	public void setCurrent(int current) {
		this.current = current;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = NumberUtil.ge(size, 1, ActionUtil.PAGE_SIZE);
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public boolean isAsc() {
		return asc;
	}

	public void setAsc(boolean asc) {
		this.asc = asc;
	}

	public String getStore() {
		return store;
	}

	public void setStore(String store) {
		this.store = store;
	}

	/**
	 * 获取默认的排序参数页面
	 * 
	 * @since 2010-1-13
	 */
	protected final Page getDefPage() {
		return new Page(getCurrent(), getSize(), getKey(), isAsc(), getStore());
	}
}
